<?php slot('products_on_index_page') ?>
<?php use_javascript('/js/basket/script.js'); ?>
<?php foreach($productGroups as $productGroup): ?>
<?php $c = 0; ?>
<div class="thumbbox">
	<div class="thumbboxtop">
		<div class="thumbboxtopleft"><img src="/enermaatik/img/saleleft2.png" width="9" height="34" alt=""/></div>
		<div class="thumbboxtopright">
			<div class="tboxleft">
				<p class="lmenu"><?php echo $productGroup['Translation'][$sf_user->getCulture()]['name'] ?></p>
			</div>
			<div class="tboxright">
				<div class="pluss">
					<img src="/enermaatik/img/pluss.png" width="19" height="18" alt=""/>
				</div>
				<div class="showall">
					<a href="<?php echo LinkGen::getInstance(LinkGen::PRODUCT_GROUP)->link($productGroup['id'])?>"><?php echo __('Näita kõiki') ?></a>
				</div>
			</div>
		</div>
	</div>
	<div class="clear"></div>
	<div class="thumbboxmain">
		<?php foreach($productGroup['Products'] as $product): ?>
		<?php ++$c; if($c > 3)break; ?>
		<?php $link = isset($productLinks[$product['Product']['id']]) ? $productLinks[$product['Product']['id']] : '#nolink'; ?>
		<div class="toodebig">
			<div class="toodebigtop">
				<a href="<?php echo $link ?>"><img src="<?php echo @myPicture::getInstance($product['Product']['ProductPictures'][0]['file'])->thumbnail(70,100)->url() ?>" width="70" height="100" alt=""/></a>
			</div>
			<div class="toodebigmain">
				<p><a href="<?php echo $link ?>"><?php echo $product['Product']['Translation'][$sf_user->getCulture()]['name'] ?></a></p>
				<h1><a href="<?php echo $link ?>"><?php echo price_format($product['Product']['price'])?></a></h1>
			</div>
			<div class="toodebigbottom">
				<a href="#"><img src="/enermaatik/img/bl.png" width="31" height="33" alt=""/></a>
				<a class="addToBasket" href="<?php echo LinkGen::getInstance(LinkGen::RAW_ACTION)->link(null, array_merge(
			array('module' => 'basketPage', 'action' => 'addProductToBasket', 'productID' => $product['Product']['id']),
			array()
		));  ?>"><img src="/enermaatik/img/korvsmall.png" width="31" height="33" alt=""/></a>
			</div>
		</div>
		<?php endforeach; ?>
		<div class="clear"></div>
	</div>
	<div class="thumbboxbottom">
		<img src="/enermaatik/img/thumbbottom.png" width="541" height="8" alt=""/>
	</div>
</div>
<?php endforeach; ?>
<script type="text/javascript">
	$('.addToBasket').addProductToBasket();
</script>
<?php end_slot() ?>